<% layout("/inc/layout_page.html"){ %>

<form action="${BASE}/admin/AdminUser/save" id="form_save" method="post">
<input type="hidden" id="id" name="id" value="${obj.id}">
<input type="hidden" id="sid" name="sid" value="${obj.sid}">
<div class="box">
  <div class="box-header">
    <h4 class="box-title"><i class="fa fa-bars"></i> 修改管理员</h4>
    <div class="box-tools">
      <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-save"></i> 保存</button>
      <a href="javascript:;" onclick="layer_close()" class="btn btn-info btn-sm"><i class="fa fa-chevron-left"></i> 返回</a>
    </div>
  </div>
  <div class="box-body">
    <table class="table tform table-bordered">

      <tr>
        <th><label for="name">登录名：</label></th>
        <td><input id="name" name="name" value="${obj.name}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="password">密码：</label></th>
        <td><input id="password" name="password" value="${obj.password}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="realName">真实姓名：</label></th>
        <td><input id="realName" name="realName" value="${obj.realName}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="sex">sex：</label></th>
        <td><input id="sex" name="sex" value="${obj.sex}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="email">邮箱：</label></th>
        <td><input id="email" name="email" value="${obj.email}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="phone">电话：</label></th>
        <td><input id="phone" name="phone" value="${obj.phone}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="mobile">手机：</label></th>
        <td><input id="mobile" name="mobile" value="${obj.mobile}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="userType">用户类型：</label></th>
        <td><input id="userType" name="userType" value="${obj.userType}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="photo">用户头像：</label></th>
        <td><input id="photo" name="photo" value="${obj.photo}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="loginIp">最后登陆IP：</label></th>
        <td><input id="loginIp" name="loginIp" value="${obj.loginIp}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="loginDate">最后登陆时间：</label></th>
        <td><input id="loginDate" name="loginDate" value="${obj.loginDate}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="loginFlag">是否可登录：</label></th>
        <td><input id="loginFlag" name="loginFlag" value="${obj.loginFlag}" type="text" class="form-control"></td>
      </tr>
      <tr>
        <th><label for="remarks">备注信息：</label></th>
        <td>
          <textarea id="remarks" name="remarks" cols="" rows="" class="form-control"  placeholder="备注信息...255个字符以内" dragonfly="true" onKeyUp="textarealength(this,255)">${obj.remarks}</textarea>
          <p class="textarea-numberbar"><em class="textarea-length">0</em>/255</p>
        </td>
      </tr>
    </table>
  </div>
  <div class="box-footer">
    <div class="box-tools pull-right">
      <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-save"></i> 保存</button>
      <a href="javascript:;" onclick="layer_close()" class="btn btn-info btn-sm"><i class="fa fa-chevron-left"></i> 返回</a>
    </div>
  </div>
</div>
</form>

<script type="text/javascript">
$(function(){
	
	$("#form_save").validate({
		errorPlacement: function(error, element) {
			error.appendTo(element.parent());
		},
		submitHandler : function(form) {
			layer.load(1, {shade: [0.3,'#fff']});
			$(form).ajaxSubmit({
				dataType:"json",
				success:function( jsondata ){
					layer.closeAll('loading');
					if( jsondata.success){
						parent.toastr.success('保存成功！');
						parent.reload_table();
						layer_close();
					}else{
						parent.toastr.error(jsondata.msg);
					}
				}
			});
		},
		rules : {
			name : {
				required : true
			}
		}, 
		messages : { 
			name : { 
				required : "名称不能为空"
			}
		}
	});
});
</script>
<% } %>